package com.jdjt.dams.entity;

import java.util.List;

import org.apache.commons.lang.StringUtils;

import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;

/**
 * 分类
 * @author Administrator
 *
 */
public class DocCateModel extends Model<DocCateModel>{
	/**
	 * 
	 */
	private static final long serialVersionUID = -8339836013055677035L;
	public static final DocCateModel dao=new DocCateModel();
	public static final Integer ROOT_NODE = 0;
	
	public Page<DocCateModel> paginate(int pageNumber, int pageSize, String name) {
		
		String sql = " from da_categories_ident";
		if(StringUtils.isNotEmpty(name)) {
			sql += " where name like '%" + name + "%' ";
		}
		sql += " order by id asc";
		return paginate(pageNumber, pageSize, "select *", sql);
	}
	public List<DocCateModel> getNodeList(String name) {
		
		String sql = "select * from da_categories_ident where name like '%"+name+"%' order by id asc";		
		return DocCateModel.dao.find(sql);
	}	
}
